package net.zoneland.knowledge.service;

import java.util.List;

import net.zoneland.knowledge.config.EsConfigInterface;
import net.zoneland.knowledge.model.EsQuestion;
import net.zoneland.knowledge.model.QaQueryDto;

/**
 * .
 *
 * @author: bcc
 *     2022/4/2
 */
public interface EsService {

    /**
     * 场景问答.
     */
    String ES_CHAT = "aitalk_chat";

    /**
     * es健康检查.
     * @param esConfig es配置.
     */
    void checkHealth(EsConfigInterface esConfig) throws Exception;

    /**
     * 批量更新题库.
     * @param list
     * @return
     * @throws Exception
     */
    List<String> dealBatch(final List<EsQuestion> list) throws Exception;

    /**
     * 根据Id查询题库数据.
     * @param id
     * @return
     * @throws Exception
     */
    EsQuestion getById(final String id) throws Exception;

    /**
     * 根据Ids查询题库数据.
     * @param ids
     * @return
     * @throws Exception
     */
    List<EsQuestion> getValidEsQuestionByIds(final List<String> ids) throws Exception;

    /**
     * 根据路径查询.
     * @param qaQueryDto
     * @return
     */
    List<EsQuestion> queryByPath(final QaQueryDto qaQueryDto) throws Exception;


    /**
     * 层级查询的情况,只查询问题.
     * @param qaQueryDto
     * @return
     * @throws Exception
     */
    List<EsQuestion> queryByPathOnlyQuestion(QaQueryDto qaQueryDto) throws Exception;

    /**
     * 闲聊.
     * @return
     * @throws Exception
     */
    String queryChat(final String queryText) throws Exception;

    /**
     * 精确查询.
     * @param qaQueryDto
     * @return
     * @throws Exception
     */
    List<EsQuestion> queryExact(final QaQueryDto qaQueryDto) throws Exception;

    /**
     * 固定词组查询
     * @param qaQueryDto
     * @return
     */
    List<EsQuestion> queryByFixWordKey(final QaQueryDto qaQueryDto) throws Exception;


    /**
     * 分词问答.
     * @param qaQueryDto
     * @return
     */
    List<EsQuestion> queryEsByTokenizer(final QaQueryDto qaQueryDto) throws Exception;

    /**
     * 查询所有.
     * @param qaQueryDto
     * @return
     */
    List<EsQuestion> queryAll(final QaQueryDto qaQueryDto) throws Exception;

    /**
     * es维护数据
     * @param jsonStr
     * @param endPoint
     * @param method
     * @return
     */
    String maintain(final String jsonStr, final String endPoint, final String method) throws Exception;
}
